# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time        : 2021/3/28 22:24
@Author      : Albert Darren
@Contact     : 2563491540@qq.com
@File        : NumSumDecomposition.py
@Version     : Version 1.0.0
@Description : TODO
@Created By  : PyCharm
"""


def dfs(k):
    l = a[k]
    for i in range(a[k - 1], (l // 2) + 1):
        a[k], a[k + 1] = i, l - i
        for j in range(1, k + 1):
            print(a[j], "+ ", end="")
        print(a[k + 1])
        dfs(k + 1)


if __name__ == '__main__':
    n = 5
    a = [1, n]
    if n > 1:
        for i in range(n - 1):
            a.append(0)
    print(n)
    dfs(1)
